// Initialize your app
var myApp = new Framework7({
    animateNavBackIcon: true
});

// Export selectors engine
var $$ = Dom7;

// Add main View
var mainView = myApp.addView('.view-main', {
    // Enable dynamic Navbar
    dynamicNavbar: true,
    // Enable Dom Cache so we can use all inline pages
    domCache: true,
//reloadPages:true
});
//头部适配安卓
if(myApp.device.android){
    $$(".navbar").height(96);
}
var userId = $$("#userId").val();
var basepath1=  $$("#basepath").val();
var token = $$("#token").val();
//取消订单操作  ajax 异步操作
$$("a[id *='canclBtn']").click(function(){
	var nameArr = $$(this).attr("name").split('_');
	var orderIdStr = nameArr[0];
	var sort = nameArr[1];
	var status = "cancel";
	if(sort ==='3'){
			var flag = updateStatus(orderIdStr,status);
			/*if(flag != '' && flag ==='true'){
				myApp.alert("订单取消成功，请与卖家联系退款！");
				
			}*/
			if(updateStatus(orderIdStr,status)){
				//此处先执行退款申请
				
				$$("#payBtn_"+orderIdStr).hide();
				$$(this).html("删除订单");
				$$(this).attr("id","delBtn_"+orderIdStr);
				$$(this).attr("name",orderIdStr);
				$$(this).parent().parent().find("div[name='statusStr_div'] span").html("已取消");
				$$(this).click(function(){
					var status = "del";
					if(confirm("您将删除单号为："+orderIdStr+"的订单，是否继续删除？")){
						if(updateStatus(orderIdStr,status)){
							$$(this).parent().parent().parent().parent().parent().remove();
						}
					}
				});
			}
			//mainView.router.load({ url:basepath1+"/phone/order/index", ignoreCache: true});
			//var html = $$(this).parent().parent().parent().parent().parent().html;
	}else{
		
			//updateStatus(orderIdStr,status);
			//mainView.router.load({ url:basepath1+"/phone/order/index", ignoreCache: true});
			//location.reload(true);
			if(updateStatus(orderIdStr,status)){
				$$("#payBtn_"+orderIdStr).hide();
				$$(this).html("删除订单");
				$$(this).attr("id","delBtn_"+orderIdStr);
				$$(this).attr("name",orderIdStr);
				$$(this).parent().parent().find("div[name='statusStr_div'] span").html("已取消");
				$$(this).click(function(){
					var status = "del";
					if(confirm("您将删除单号为："+orderIdStr+"的订单，是否继续删除？")){
						if(updateStatus(orderIdStr,status)){
							$$(this).parent().parent().parent().parent().parent().remove();
						}
					}
				});
			}
	}
	
});

//删除订单操作
$$("a[id *='delBtn']").click(function(){
	var orderIdStr = $(this).attr("name");
	var status = "del";
	if(confirm("您将删除单号为："+orderIdStr+"的订单，是否继续删除？")){
		if(updateStatus(orderIdStr,status)){
			$$(this).parent().parent().parent().parent().parent().remove();
		}
		
	}
});

//确认支付操作 跳转到支付结果页
$$("a[id*='payBtn']").on('click', function(){
	var token = $$("#token").val();
	var orderIdStr = $(this).attr("name");
	var basepath1=  $("#basepath").val();
	var data = {};
	data["id"] = orderIdStr;
	var _url = basepath1+"/phone/order/toPay?token="+token;
	var bankPayNo = getBankLsNo(orderIdStr);
	if(bankPayNo ==='' || bankPayNo === null){
		myApp.alert("获取银行流水号失败，请联系管理员！");
		return false;
	}
	//调用原生 调出支付
	WebViewJavascriptBridge.callHandler(
	        'expoPay'
	        , bankPayNo
	        , function(responseData) {
	        	if('success' === responseData){
	        		$$.post(_url, data, function(responseData){
	        			var res = JSON.parse(responseData);
	        			if(res != null && res.success === false){
	        				myApp.alert(res.msg);
	        			}else if(res.success && res.orderId != ''){
	        				mainView.router.load({ url:basepath1+"/phone/order/result?orderId="+res.orderId + "&token="+token, ignoreCache: true});
	        			}
	        		});
	        	}else if("cancel" === responseData){
	        		myApp.alert("用户取消了操作");
	        	}else{
	        		myApp.alert("支付失败，请稍后重试！");
	        	}
	        }
	    );
	/*$$.post(_url, data, function(responseData){
		if(responseData != null  && " " != responseData) {
			//myApp.alert(responseData);
			mainView.router.load({ url:basepath1+"/phone/order/result?orderId="+responseData, ignoreCache: true});
		}
	});*/
	
	
});
$$("a[id*='detailBtn']").click(function(){
	var orderIdStr = $(this).attr("name");
	var token = $$("#token").val();
	var basepath1=  $("#basepath").val();
	var _url = basepath1+"/phone/order/detail?orderId=" + orderIdStr +"&token =" + token;
	mainView.router.load({ url:_url, ignoreCache: true});
});

//查看物流

$("a[id *='lookBtn']").click(function(){
	var expressInfoStr = $(this).attr("name");
	var expressInfoArr = expressInfoStr.split("-");
	var expressCompName = expressInfoArr[0];
	var expressNum = expressInfoArr[1];
	//测试数据
//	if(expressCompName ===''){
//		expressCompName='quanfengkuaidi';
//	}
//	if(expressNum ===''){
//		expressNum = '123456';
//	}
	if(expressCompName ==='' || expressNum ===''){
		myApp.alert("您查询的快递信息不存在！");
		return false;
	}
	var currentUrl = window.location.href;
	var wlHref = 'http://m.kuaidi100.com/index_all.html?type='+expressCompName+'&postid='+expressNum+'&callbackurl='+currentUrl;
	//var win = window.open("","物流信息");
	window.location.href = wlHref;
	
});
//换货操作
$("a[id *='changeBtn']").click(function(){
	var orderIdStr = $(this).attr("name");
	var _url = basepath1+"/phone/order/changeProduct/show?orderId=" + orderIdStr;
	mainView.router.load({ url:_url, ignoreCache: true});
	//window.location.href = _url;
});

//修改订单状态
function updateStatus(orderIdStr,status){
var res = "";
var data = {};
data["orderId"] = orderIdStr;
data["userId"] = userId;
data["status"] = status;

var _url = basepath1+"/phone/order/update";
$$.post(_url, data, function(responseData){
	if(0 === responseData || "0" === responseData) {
		return "true";
	}
});
return "false";
}

var detailCallback = myApp.onPageInit('order-confirm', function (page) {
    var mySwiper = myApp.swiper('.swiper-container', {
        pagination: '.swiper-pagination'
    });
    $$("#paymentBtn").on("click",function(){
    	var token = $$("#token").val();
    	var orderId= $$(this).attr("name");
    	var lyCountent = $$("#mjCmment").val();
    	if(orderId ===''){
    		return false;
    	}
    	var data = {};
    	data["orderId"] = orderId;
    	data["lyCountent"] = lyCountent;
    	var _url = basepath1+"/phone/order/mjLy";
    	$$.post(_url, data, function(responseData){
    		var basepath1=  $("#basepath").val();
    		var data = {};
    		data["id"] = orderId;
    		var _url = basepath1+"/phone/order/toPay?token="+token;
    		$$.post(_url, data, function(responseData){
    			if(responseData != null  && " " != responseData) {
    				//myApp.alert(responseData);
    				mainView.router.load({ url:basepath1+"/phone/order/result?orderId="+responseData + "&token="+token, ignoreCache: true});
    			}
    		});
    	});
    });
    
    
});

var changeCallback = myApp.onPageInit('product-change', function (page) {
    $$("#qrBtn").click(function(){
    	var id= $$(this).attr("name");
    	var orderId= $$("#orderId").val();
    	var imgUrl = $$("#imgurl").val();
    	var backreson = $$("#backreson").val();
    	if(orderId ===''){
    		return false;
    	}
    	var data = {};
    	data["orderId"] = orderId;
    	data["backreson"] = backreson;
    	data["id"] = id;
    	data["imgUrl"] = imgUrl;
    	data["status"] = '2';
    	var _url = basepath1+"/phone/order/changeProduct/saveOrUpdate";
    	$$.post(_url, data, function(responseData){
    		if(responseData === 'true'){
    			myApp.alert('换货申请保存成功！');
    			window.location.reload();
    		}
    	});
    });
    
    $("#choose_cancle").click(function(){
    	hiddenChooseBlanck();
    });
    $("#imgchoose_blank").click(function(){
    	hiddenChooseBlanck();
    });
    $(document).ready(function(){
    	var basepath1=  $$("#basepath").val();
    	//查看物流
    	$("a[id *='lookBtn']").click(function(){
    		var expressInfoStr = $(this).attr("name");
    		var expressInfoArr = expressInfoStr.split("-");
    		var expressCompName = expressInfoArr[0];
    		var expressNum = expressInfoArr[1];
    		if(expressCompName ==='' || expressNum ===''){
    			myApp.alert("您查询的快递信息不存在！");
    			return false;
    		}
    		var currentUrl = window.location.href;
    		var wlHref = 'http://m.kuaidi100.com/index_all.html?type='+expressCompName+'&postid='+expressNum+'&callbackurl='+currentUrl;
    		//var win = window.open("","物流信息");
    		window.location.href = wlHref;
    		
    	});
    	
    	//换货时 确认已向 卖家发货
    	$$("#returnSallerSendBtn").on('click', function(){
    		var pressName = $("#backsallerpressname").val();
    		var pressCode = $("#backsallerpresscode").val();
    		var pressNo = $("#backsallerpressno").val();
    		var sallerAddress = $("#salleraddress").val();
    		var orderId = $("#orderId").val();
    		var token = $("#token").val();
    		var id = $(this).attr("name");
    		
    		if(sallerAddress === ''){
    			myApp.alert("退货，卖家收货地址不能为空！");
    			return false;
    		}
    		if(pressName === ''){
    			myApp.alert("换货承运商不能为空！");
    			return false;
    		}
    		if(pressNo === ''){
    			myApp.alert("换货运单号不能为空！");
    			return false;
    		}
    		var data = {};
        	data["orderId"] = orderId;
        	data["pressName"] = pressName;
        	data["pressCode"] = pressCode;
        	data["id"] = id;
        	data["pressNo"] = pressNo;
        	data["sallerAddress"] = sallerAddress;
        	var _url = basepath1+"/phone/order/updateReturnProductInfo";
        	$$.post(_url, data, function(responseData){
        		if(responseData === 'true'){
        			myApp.alert('退货发货确认成功，请耐心等待卖家寄出新货！');
        			mainView.router.load({ url:basepath1+"/phone/order/index?token="+token, ignoreCache: true});
        		}
        	});
    	});
    	$$("#qrSdNewGoods").on('click', function(){
    		var orderId = $("#orderId").val();
    		var token = $("#token").val();
    		var id = $(this).attr("name");
    		var data = {};
        	data["orderId"] = orderId;
        	data["id"] = id;
        	data["flag"] = "6";
        	var _url = basepath1+"/phone/order/updateReturnProductStatus";
        	$$.post(_url, data, function(responseData){
        		if(responseData === 'true'){
        			myApp.alert('已经确认收到新货！');
        			mainView.router.load({ url:basepath1+"/phone/order/index?token="+token, ignoreCache: true});
        		}
        	});
    	});
    	var orderId= $$("#orderId").val();
    	var status = $("#status").val();
    	var cotrolFlag = $("#flag").val();
    	if(cotrolFlag == '' || cotrolFlag === '0'){
    		cotrolFlag = '1';
    	}
    	if(status == ''){
    		status == '0';
    	}
    	if(status != '3' && cotrolFlag === '1'){
    		$("#controll_div").show();
    	}
//      用于压缩图片的canvas
    	  var canvas = document.createElement("canvas");
    	  var ctx = canvas.getContext('2d');

    	  //    瓦片canvas
    	  var tCanvas = document.createElement("canvas");
    	  var tctx = tCanvas.getContext("2d");

    	  var maxsize = 100 * 1024;
		function connectWebViewJavascriptBridge(callback) {
	        if (window.WebViewJavascriptBridge) {
	            callback(WebViewJavascriptBridge)
	        } else {
	            document.addEventListener(
	                'WebViewJavascriptBridgeReady'
	                , function() {
	                    callback(WebViewJavascriptBridge)
	                },
	                false
	            );
	        }
	    }
	    connectWebViewJavascriptBridge(function(bridge) {
	        bridge.init(function(message, responseCallback) {
	            console.log('JS got a message', message);
	            var data = {
	                'Javascript Responds': '测试中文!'
	            };
	            console.log('JS responding with', data);
	            responseCallback(data);
	        });

        bridge.registerHandler("functionInJs", function(data, responseCallback) {
            document.getElementById("show").innerHTML = ("data from Java: = " + data);
            var responseData = "Javascript Says Right back aka!";
            responseCallback(responseData);
        });
    });
    	$("#choose_local").click(function(e){
    		var fileId = $("#orderId").val();
    		
    		//调用原生  调用原生接口 从本地相册 选择照片
    		WebViewJavascriptBridge.callHandler(
        	        'pickPhotoWrapper'
        	        , {'param': "wwww"}//参数没有用到
        	        , function(responseData) {//原生不会通过该方法的回调提供返回值。
        	            //document.getElementById("show").innerHTML = "send get responseData from java, data = " + responseData;
        	        }
        	    );
    		getYsReturnInfo();
        });
    	
        $("#choose_camare").click(function(e){
        	//调用原生  调用原生接口 启动照相机
        	WebViewJavascriptBridge.callHandler(
        	        'takePhotoWrapper'
        	        , {'param': "abcd"}//参数没有用到
        	        , function(responseData) {//原生不会通过该方法的回调提供返回值。
        	           // document.getElementById("show").innerHTML = "send get responseData from java, data = " + responseData;
        	        }
        	    );
        		getYsReturnInfo();
        });
        //测试本地上传文件
        function uploadImgLocal(file,id){
        	var _url = $("#basepath").val() + "/common/upload";
        	$.ajax({ 
        		type : "POST", 
        		url : _url,
        		dataType:'json',
        		data:{'id':productID,'imgFile':file},
        		async : false,
        		contentType : "application/x-www-form-urlencoded;charset=UTF-8",
        		success : function(result) { 
        			
        		},
        		error:function(XMLHttpRequest, textStatus, errorThrown) {
        			myApp.alert("数据更新失败！");
        		}
        	});
        }
        //移除 本地库 图片保存信息
        function removeImgLocal(fileId){
        	$.ajax({ 
        		type : "POST", 
        		url : $("#basepath").val() + "/phone/order/removeImgLocal",
        		dataType:'json',
        		data:{'fileId':fileId},
        		async : false,
        		contentType : "application/x-www-form-urlencoded;charset=UTF-8",
        		success : function(result) { 
        			
        		},
        		error:function(XMLHttpRequest, textStatus, errorThrown) {
        			myApp.alert("数据更新失败！");
        		}
        	});
        }
        //点击图片上传按钮 上传 图片
        $("#uploadBtn").click(function(){
        	 //预览完毕
	        //上传图片
	        var imageList = new Array();
	       if($("li[name='imgLi']").length >0){
	    	   $("li[name='imgLi']").each(function(){
	    		   var fileObj = {};
        			var imgPath = $(this).attr("data-name");
        			if(imgPath != '' && imgPath != null){
        				fileObj.filePath = imgPath;
        				imageList[imageList.length] = fileObj;
        			}
        		});
	    	   //调用原生 上传照片
	    	   WebViewJavascriptBridge.callHandler(
		                'uploadImageWrapper'
		                , {'imageList': imageList}//参数A ，为json字符串
		                , function(responseData) {//原生不会通过该方法的回调提供返回值。
		                    //document.getElementById("show").innerHTML = "send get responseData from java, data = " + responseData
		                }
		            );
	    	 //调用原生 上传照片成功后 返回 照片保存信息
	    	   WebViewJavascriptBridge.registerHandler("getUploadResult", function(data, responseCallback) {
	    	       //data参数为，图片上传成功之后服务器的返回的json字符串；
	    	        var responseData = "Javascript Says Right back aka!";
	    	        responseCallback(responseData);//回调方法，随便填原生没有用到
	    	        var res = JSON.parse(data);
	    	        var orderId = $$("#orderId").val();
		             if(res.succeed && res.data.length > 0){
			        	/*var html = '<ul id="imagsUp_success">';
			        	for(var i=0;i<res.data.length;i++){
			        		html += '<a target="blanck" href="'+res.data[i].fileUrl+'"><img src="'+res.data[i].fileUrl+'"/>'+ res.data[i].fileName+'</a>';
			        	}
			        	html += '</ul>';
			        	$("#show").html(html);*/
		            	//将图片上传信息保存到本地数据库
		            	
			           saveImagePath(res.data,orderId);
			        }
	    	    });
	       }
        });
       //获取选择 或拍照后原生返回的 照片信息
        function getYsReturnInfo(){
        	WebViewJavascriptBridge.registerHandler("getImagePathResult", function(data, responseCallback) {
 		       //data参数为，图片路径的 json字符串，是数组；
 		        var responseData = "Javascript Says Right back aka!";
 		        responseCallback(responseData);//回调方法，随便填原生没有用到
 		        var res = JSON.parse(data);
 		        if(res != null && res.length >0){
 		        	for(var i=0;i <res.length;i++){
 		        		if($("li[name='imgLi']").length === 9){
 		        			return;
 		        		}
 		        		var file = "data:image/png;base64,"+res[i].base64;
 		        		var localPath = res[i].filePath;
 		        		var ysImg = "data:image/png;base64,"+res[i].base64;
 		        		var type = res[i].filePath.substr(res[i].filePath.length-4);
 		        		//避免重复 添加之前 先对比是否有相同 照片
 		        		$("li[name='imgLi']").each(function(){
 		        			if($(this).attr("data-name") === localPath){
 		        				$(this).remove();
 		        			}
 		        		});
 		        		//获取图片大小
 		        	      var size = file.length / 1024 > 1024 ? (~~(10 * file.length / 1024 / 1024)) / 10 + "MB" : ~~(file.length / 1024) + "KB";
 		        	      var img = new Image();
 		        	      img.src = file;
 		        	      //图片过大 进行压缩
 		        	      if(file.length > maxsize){
 		        	    	  file = compress(img);
 		        	      }
 		        	      var html = '<li name="imgLi" style="background-image:url("'+file+')" data-name="'+localPath+'">' +
 		        	      '<div style="height:20px;width:100%;font-size:12px;">'+
 		        	      '<div style="float:right;width:30px;height:18px;" name="removeLi" calss="del_icon">'+
 		        	      '<img src="/jshop/resource/phone/img/crash.png" style="width:16px;height:16px;display:block;float:right;" />'
 		        	      +'</div>'+
 		        	      '</div>'+
 		        	      '<img name="img_file" style="width:100px;height:80px;" src="'+file+'"/>'+
 		        	      '<div class="progress"><span></span></div><div class="size">' + size + '</div></li>';	
 		        	      $(".img-list").append(html);
 		        	     //uploadImgLocal(file,orderId);
 		        	      $("div[name='removeLi']").click(function(){
 		        	    	  $(this).parent().parent().remove();
 		        	      });
 		        	}
 		        	if($("li[name='imgLi']").length > 0){
 		        		$("#uploadBtn").show();
 		        	}
 		        }
 		    });
        }
      //将图片上传信息保存到本地数据库
        function saveImagePath(dataList,id){
        	if(dataList.length > 0){
        		for(var i = 0;i < dataList.length;i++){
        			var dataInfo = {};
        			dataInfo.id = id;
        			dataInfo.fileId = dataList[i].fileId;
        			dataInfo.fileName = dataList[i].fileName;
        			dataInfo.fileSize = dataList[i].fileSize;
        			dataInfo.fileExt = dataList[i].fileExt;
                	$.ajax({ 
                		type : "POST", 
                		url : $("#basepath").val() + "/phone/order/saveUploadImagPath",
                		dataType:'json',
                		data: dataInfo,
                		async : false,
                		contentType : "application/x-www-form-urlencoded;charset=UTF-8",
                		success : function(result) { 
                			//myApp.alert(" 照片上传成功！");
                		},
                		error:function(XMLHttpRequest, textStatus, errorThrown) {
//                			myApp.alert(XMLHttpRequest);
//                			myApp.alert(textStatus);
//                			myApp.alert(errorThrown);
                			myApp.alert("数据更新失败！");
                			return false;
                		}
                	});
        		}
        	}
        }
        //点击移除按钮时 移除 图片
        $("div[name='removeLi']").click(function(){
        	var status = $("#status").val();
        	var cotrolFlag = $("#flag").val();
        	if(cotrolFlag == ''){
        		cotrolFlag == '1';
        	}
        	if(!(status != '3' && cotrolFlag === '1')){
        		return false;
        	}
	    	  $(this).parent().parent().remove();
	    	  var imgInfoId = $(this).attr("id");
	    	  removeImgLocal(imgInfoId);
	      });
//      使用canvas对大图片进行压缩
        function compress(img) {
          var initSize = img.src.length;
          var width = img.width;
          var height = img.height;

          //如果图片大于四百万像素，计算压缩比并将大小压至400万以下
          var ratio;
          if ((ratio = width * height / 4000000) > 1) {
            ratio = Math.sqrt(ratio);
            width /= ratio;
            height /= ratio;
          } else {
            ratio = 1;
          }

          canvas.width = width;
          canvas.height = height;

//              铺底色
          ctx.fillStyle = "#fff";
          ctx.fillRect(0, 0, canvas.width, canvas.height);

          //如果图片像素大于100万则使用瓦片绘制
          var count;
          if ((count = width * height / 1000000) > 1) {
            count = ~~(Math.sqrt(count) + 1); //计算要分成多少块瓦片

//                  计算每块瓦片的宽和高
            var nw = ~~(width / count);
            var nh = ~~(height / count);

            tCanvas.width = nw;
            tCanvas.height = nh;

            for (var i = 0; i < count; i++) {
              for (var j = 0; j < count; j++) {
                tctx.drawImage(img, i * nw * ratio, j * nh * ratio, nw * ratio, nh * ratio, 0, 0, nw, nh);

                ctx.drawImage(tCanvas, i * nw, j * nh, nw, nh);
              }
            }
          } else {
            ctx.drawImage(img, 0, 0, width, height);
          }

          //进行最小压缩
          var ndata = canvas.toDataURL('image/jpeg', 0.1);

          console.log('压缩前：' + initSize);
          console.log('压缩后：' + ndata.length);
          console.log('压缩率：' + ~~(100 * (initSize - ndata.length) / initSize) + "%");

          tCanvas.width = tCanvas.height = canvas.width = canvas.height = 0;

          return ndata;
        }
    });
    $("#choose_start").click(function(){
    	
    	$("#imgchoose_blank").show();
    });
    
    function hiddenChooseBlanck(){
    	$("#imgchoose_blank").hide();
    }
$$("#cancleBtn").click(function(){
    	
    	var id= $$(this).attr("name");
    	var orderId= $$("#orderId").val();
    	var imgUrl = $$("#imgurl").val();
    	var backreson = $$("#backreson").val();
    	if(orderId ===''){
    		return false;
    	}
    	var data = {};
    	data["orderId"] = orderId;
    	data["backreson"] = backreson;
    	data["id"] = id;
    	data["imgUrl"] = imgUrl;
    	data["status"] = '3';
    	var _url = basepath1+"/phone/order/changeProduct/saveOrUpdate";
    	$$.post(_url, data, function(responseData){
    		if(responseData === 'true'){
    			myApp.alert('换货申请取消成功！');
    			window.location.reload();
    		}
    	});
    });
    
});
function backSchome(){
	var basepath1=  $("#basepath").val();
	var token = $$("#token").val();
	window.location.href = basepath1 + "/phone/home?token="+token;
}
//支付前 调用中间服务 获取银行流水号
function getBankLsNo(orderId){
	var res = "";
	var token = $("#token").val();
	var basepath =  $("#basepath").val();
	$.ajax({ 
		type : "POST", 
		url : basepath + "/phone/order/getBankLsNo",
		data:{'orderId':orderId,'token':token},
		async : false,
		contentType : "application/x-www-form-urlencoded;charset=UTF-8",
		success : function(result) { 
			res = result;
		},
		error:function(XMLHttpRequest, textStatus, errorThrown) {
			myApp.alert("与服务器通信失败");
			res = "";
		}
	});
	return res;
}

//我的订单校园缴费查询ajax

/*$(document).on('click','.zyschool',function(){
    var token = $("#token").val();
    var memberCode = $("#memberCode").val();
     myApp.alert(obj.content);
    $.ajax({
        type:"POST",
        url:"/phone/payment/list?token="+token,
        data:{'pageNo':1,'pageSize':15,"memberCode":memberCode},
        async:false,
        contentType:"application/x-www-form-urlencoded;charset=UTF-8",
        success:function(result,textStatus, jqXHR){
            if (result.success) {
                $.each(result.data, function(idx, obj){
                    myApp.alert(obj.content);
                })
            }

            
   //          <div class="messageBlank lr-padding fn-clear" >
            //  <div class="imgBlank">
            //      <img style="height:62px;width:62px;"src="${staticpath}/phone/img/icon-jxfd.png">
            //  </div>
            //  <div class="jfxxBlank" >
            //      <div class="jfnamBlank" >
            //          9月小饭桌费
            //      </div>
                    
            //      <div class="khxxBlank" >
            //          安宁市第一中学&nbsp;&nbsp;&nbsp;&nbsp;张小花
            //      </div>
            //  </div>
            //  <div class="jfjeBlank">
            //      <div class="jtFy">￥220.00</div>
            //  </div>
            // </div>

            // {
            //   "succeed": true,
            //   "code": 0,
            //   "msg": "获取消费信息成功",
            //   "data": [
            //     {
            //       "id": "24726128937665991",
            //       "feeId": "24726128937665231",
            //       "name": "校服费",
            //       "content": "2016年秋季学期校服费",
            //       "studentCode": "u=11",
            //       "studentName": "张毅",
            //       "status": "1",
            //       "type": "校园缴费",
            //       "money": 123,
            //       "payDate": 1474357931000,
            //       "orderNo": "14743579310810001",
            //       "payDateStr": "2016-09-20 15:52:11"
            //     }
            //   ]
            // }


        },
        error:function(XMLHttpRequest, textStatus, errorThrown) {
           myApp.alert("","与服务器通信失败");
            res = "";
        }
    })
});*/
